package com.xubeihong.xubeihong;

import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.concurrent.*;

@Slf4j
@Component
public class TicketRun {

    ScheduledExecutorService scheduler = Executors.newScheduledThreadPool(3);

    @Autowired
    TicketTask task;


    //@Scheduled(cron = "59 59 9 * * ?")
    @Scheduled(cron = "25 11 14 * * ?")
    public int getTicket() throws ExecutionException, InterruptedException {
        scheduler.scheduleAtFixedRate(task,0,500, TimeUnit.MILLISECONDS);
        return 0;
    }
}
